
package br.ufrgs.tcp;

import android.app.ListActivity;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.support.v4.widget.SimpleCursorAdapter;
import br.ufrgs.tcp.db.AppSQLHelper;
import br.ufrgs.tcp.model.Sala;

public class ResultActivity extends ListActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.result);

		Intent i = getIntent();
		Cursor salas = Sala.fetchByNumero(i.getStringExtra("query"));
		SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.sala, salas, AppSQLHelper.SALA_COLUMNS, 

				new int[] {
			R.id.tvSala, R.id.tvPredio 
		}, 0);
		setListAdapter(adapter);
	}

}
